home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / PROGRAMMING / DESKLIBC / SOURCES.ZIP / DeskLib / !DLSources / Libraries / Str / c / stricmpcr < prev    next >
Text File  |  1995-07-08  |  1KB  |  40 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Str.stricmpcr.c
  12.     Author:  Copyright © 1994 Tim Browse
  13.     Version: 1.00 (06 Mar 1994)
  14.     Purpose: Version of stricmp that works on CR-terminated strings.
  15. */
  16.  
  17. #include <ctype.h>
  18.  
  19. #include "DeskLib:Str.h"
  20.  
  21. int stricmpcr(char *s1, char *s2)
  22. {
  23.   char ch1 = 0, 
  24.        ch2 = 0;
  25.  
  26.   for(;;)
  27.   {
  28.     if ((*s1 < 32) && (*s2 < 32))
  29.       return 0; /* s1 and s2 are equal */
  30.       
  31.     ch1 = toupper(*s1);
  32.     ch2 = toupper(*s2);
  33.  
  34.     if (ch1 != ch2)
  35.       return (int) (ch1 - ch2);
  36.     s1++;
  37.     s2++;
  38.   }
  39. }
  40.